package com.sunday.auth.factory;

import com.sunday.auth.entity.Animal;
import com.sunday.auth.entity.Dog;
import com.sunday.auth.entity.Mouse;

import java.util.HashMap;
import java.util.Map;

/**
  @program: design-patterns
  @author: Jh
  @create: 2021-09-06 17:33
*/
public class AnimalFactory {

    public static Map<Integer, Animal> TYPE_ITEM_MAPPING = new HashMap<>(16);

    static {
        TYPE_ITEM_MAPPING.put(1,new Dog());
        TYPE_ITEM_MAPPING.put(2,new Mouse());
    }

    public static Animal getFunction(Integer type){
        return TYPE_ITEM_MAPPING.get(type);
    }


}
